<?php

/**
 *
 * @file   GroupController.php
 * @date   2016-9-1 15:11:41
 * @author Zhenxun Du<5552123@qq.com>
 * @version    SVN:$Id:$
 */

namespace app\admin\controller;

class User extends Common {

    /**
     * 发布管理
     * @return [type] [description]
     */
    public function index() {
        /*$where = array();
        $lists = db("user")->where($where)->order('id desc')->paginate(10);
        $this->assign('data', $lists);
        return $this->fetch();*/
        $keyword=input('keywork');
        if (!empty($keyword)) {
            $map['nickname']=['like','%'.$keyword.'%'];
            $lists=db('user')->where($map)->order('id desc')->paginate(10);
            //dump($lists);exit;
        }else{
            $where=array();
            $lists=db('user')->where($where)->order('id desc')->paginate(10);
            //dump($lists);exit;
        }
        $this->assign('data', $lists);
        return $this->fetch();
    }
    /**
     * 更改状态
     * @return [type] [description]
     */
    public function del() {
        $id = input('id');
        $status = -1;
        $save = array('id'=>$id,'status'=>$status);
        $val = db('post')->update($save);
        if($val){
             $this->success('禁言成功');
        }else{
             $this->error('禁言失败');
        }
    }



}
